\name{GVECd}
\alias{GVECd}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Estimates functions with different deterministic components}
\description{
Tries the different combinations of the deterministic components.}
\usage{
GVECd(x, deltas, p, s, d = list())
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{x}{
A multivariate series.
}
  \item{deltas}{
List of distinct polynomials.}
  \item{p}{
Order of the GVEC.}
  \item{s}{
Seasonality: number of observations per year.}
  \item{d}{
List of deterministic terms ("i" for intercept; "t" for linear trend).}
}
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
A list with the following: 
\item{estcoef}{estimated coefficients of the GVEC.}
\item{covcoef}{Not yet implemented.}
\item{res}{Residuals.}
\item{rescov}{Residual covariance matrix.}
\item{determ}{deterministic terms of the GVEC.}
\item{list.Delta}{difference operators of the GVEC. These are the Delta_jkl operators in proposition 3.}
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (y, deltas, p, s, d = list()) 
{
    k = ncol(y)
    n = nrow(y)
    determ = list("i", "t")
    if (class(d) == "list") {
        fitmodel = GVECfit(y, deltas, p, s, d)
    }
    else {
        if (class(d) == "character") {
            if (class(d) == "AIC") {
                combinat = as.matrix(expand.grid(c(0, 1), c(0, 
                  2)))
                vec.BIC = rep(0, nrow(combinat))
                for (j in 1:nrow(combinat)) {
                  fitmodel = GVECfit(y, deltas, p, s, determ[combinat[j, 
                    ]])
                  vec.BIC[j] = log(det(fitmodel$rescov)) + k^2 * 
                    j * log(n)/n
                }
                comb = determ[which.min(vec.BIC)]
                fitmodel = GVECfit(y, deltas, p, s, comb)
                return(fitmodel)
            }
            else {
                combinat = as.matrix(expand.grid(c(0, 1), c(0, 
                  2)))
                vec.AIC = rep(0, nrow(combinat))
                for (j in 1:nrow(combinat)) {
                  fitmodel = GVECfit(y, deltas, p, s, determ[combinat[j, 
                    ]])
                  vec.AIC[j] = log(det(fitmodel$rescov)) + k^2 * 
                    j * log(n)/n
                }
                comb = determ[which.min(vec.AIC)]
                fitmodel = GVECfit(y, deltas, p, s, comb)
                return(fitmodel)
            }
        }
        else {
            cat("error: d must be either a list of deterministic terms or an information criterion (BIC or AIC)")
            return()
        }
    }
  }
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
